import os
from comfy.comfyclient import ComfyClient
import os.path
from utils.utils import get_json
from comfy.workflow_common import process_image

# 获取当前工作目录
current_path = os.getcwd()

face_id_prompt_list = [
  {
    "id": '1',
    "positive": 'test',
    "negative": 'test',
    "model": ''
  }
]

def workflow_face_id(comfy: ComfyClient, face_image, target_image):
  """
  Purpose: face id 工作流
  @param {face_image} 用户人脸图片
  @param {target_image} prompt模板id
  """
  root = 'face_id'
  source_face = process_image(face_image, root, 0) 
  target_face = process_image(target_image, root, 1) 
  face_id_prompt = get_json(os.path.join(current_path, 'comfy/workflow_face_id.json'))
  face_id_prompt['3']['inputs']['image'] = f"{root}/{source_face}"
  face_id_prompt['33']['inputs']['image'] = f"{root}/{target_face}"
  
  comfy.gen_images(face_id_prompt)
# end def
